/**
 * Created by pans on 15-1-19.
 */
/**
 * 封装的http服务，包含一个sessionKey，为了从服务器请求数据
 */
angular.module('htmsMobileApp')
  .factory('CustomHttp', function CustomHttp($http,serverAddr) {
    return {
      get : function(url,config){
        url = "/"+serverAddr.name + url;
        return $http.get(url,config);
      },
      del : function(url,config){
        url = "/"+serverAddr.name + url;
        return $http.delete(url,config);
      },
      head : function(url,config){
        url = "/"+serverAddr.name + url;
        return $http.head(url,config);
      },
      jsonp : function(url,config){
        url = "/"+serverAddr.name + url;
        return $http.jsonp(url,config);
      },

      post : function(url,data,config){
        url = "/"+serverAddr.name + url;
        return $http.post(url,data,config);
      },
      put : function(url,data,config){
        url = "/"+serverAddr.name + url;
        return $http.put(url,data,config);
      },
      patch : function(url,data,config){
        url = "/"+serverAddr.name + url;
        return $http.patch(url,data,config);
      }
    }
  });
